<?php 
// 货品列表模型
   class ShoplistModel extends Model{
      public $table='goods_list';

  

 
 public function addData(){

  if(!$this->create())  return flase;
   $spec=Q('post.spec');
   $attr_name=Q('post.attr_name');
   if ($_POST['number'] == ''){
      $number = date('ymd') . $_POST['gid'] . implode('', $_POST['spec']);
    }else{
      $number=Q('post.number');
   }
   
   $gid=Q('post.gid');
   $type_id=Q('post.type_id');
   $combine=implode(',',$_POST['spec']);
   $inventory=Q('post.inventory');

// 数据提交
   $data=array(
      'gid'=>$gid,
      'combine'=>$combine,
      'inventory'=>$inventory,
       'number'=>$number
    );

   $this->add($data);


return true;

 }

// 修改
public function editData($gtid){
    if(!$this->create()) return false;
  return  $this->where("gtid={$gtid}")->update();
    
  }



   }
 



 ?>